js object random key

95

js object random key -

var randomProperty = function (obj) {
    var keys = Object.keys(obj);
    return obj[keys[ keys.length * Math.random() << 0]];
};

Comments

Submit
0 Comments